import RequestUtils from '@/utils/RequestUtils'

const groupName = 'system'
const apiName = 'org'

export default {
  add(params = {}) {
    return RequestUtils({
      url: `/${groupName}/${apiName}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  remove(id) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/${id}`,
      method: 'DELETE'
    })
  },
  edit(params = {}) {
    return RequestUtils({
      url: `/${groupName}/${apiName}`,
      method: 'PUT',
      data: {
        ...params
      }
    })
  },
  get(id) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/${id}`,
      method: 'GET'
    })
  },
  list(params = {}) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/search`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  page(params = {}, page) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/search/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  tree(params = {}) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/search/tree`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  treeSelect(params = {}) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/search/treeSelect`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  exportData(params = {}) {
    return RequestUtils({
      url: '/sys/dict/data/export',
      method: 'GET',
      data: {
        ...params
      }
    })
  }

}
